package com.ruoyi.system.controller;

import java.util.List;
import com.ruoyi.system.domain.SysRegion;
import com.ruoyi.system.service.ISysRegionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.security.annotation.PreAuthorize;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;

/**
 * 地区Controller
 * 
 * @author ruoyi
 * @date 2021-06-22
 */
@RestController
@RequestMapping("/housemanager/region")
public class SysRegionController extends BaseController
{
    @Autowired
    private ISysRegionService sysRegionService;

    /**
     * 查询地区列表
     */
    @PreAuthorize(hasPermi = "house:housemanager:region:list")
    @GetMapping("/list")
    public AjaxResult list()
    {

        List<SysRegion> list=sysRegionService.selectSysRegionList();
        return AjaxResult.success(list);
    }

    /**
     * 查询地区列表
     */
    @PreAuthorize(hasPermi = "house:housemanager:region:query")
    @GetMapping("/{id}")
    public AjaxResult getByPid(@PathVariable("id")Integer id)
    {
        List<SysRegion> list = sysRegionService.selectSysRegionByPid(id);
        return AjaxResult.success(list);
    }

}
